package com.google.code.jtasks.adapter;

import java.util.HashSet;
import java.util.Set;

import com.google.code.jtasks.adapters.ITaskSystemAdapter;
import com.google.code.jtasks.model.IMappedTask.TaskField;
import com.google.code.jtasks.query.TaskQuery;
import com.google.code.jtasks.query.TaskQueryResult;

/**
 * A mock implementation of {@link ITaskSystemAdapter} for use in tests.
 */
public class MockTaskSystemAdapter implements ITaskSystemAdapter
{
	private final TaskQueryResult mockResult;

	/**
	 * Constructs a new {@link MockTaskSystemAdapter}.
	 * 
	 * @param mockResult
	 *            the mock {@link TaskQueryResult} that should be returned by {@link #runQuery(TaskQuery)}
	 */
	public MockTaskSystemAdapter(TaskQueryResult mockResult)
	{
		this.mockResult = mockResult;
	}

	/**
	 * @see com.google.code.jtasks.adapters.ITaskSystemAdapter#getUnsupportedTaskFields()
	 */
	@Override
	public Set<TaskField> getUnsupportedTaskFields()
	{
		return new HashSet<TaskField>();
	}

	/**
	 * @see com.google.code.jtasks.adapters.ITaskSystemAdapter#runQuery(com.google.code.jtasks.query.TaskQuery)
	 */
	@Override
	public TaskQueryResult runQuery(TaskQuery query)
	{
		return mockResult;
	}
}
